import React, { Component } from 'react';
import PropTypes from 'proptypes';
// import Checkbox from '@material-ui/core/Checkbox';
import {Form} from "react-bootstrap"
export default class CheckboxMe extends Component {
  static propTypes = {
    name: PropTypes.string.isRequired,
    label: PropTypes.string.isRequired,
    disabled: PropTypes.bool,
    defaultChecked: PropTypes.bool,
    onChecked: PropTypes.func.isRequired,
    onUnchecked: PropTypes.func.isRequired,
  };
  onChange = () => {
    if (!this.props.defaultChecked) {
      this.props.onChecked();
    } else {
      this.props.onUnchecked();
    }
  };
  render() {
    const { name, label, disabled } = this.props;
    //todo
    return (
        <Form.Check
          name={name}
          label={label}
          disabled={disabled}
          checked={this.props.defaultChecked}
          onChange={this.onChange}
        />
    );
  }
}
